import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop021_商品管理商品品牌添加品牌"
firefox=openBrowser(urlAdmin)
firefox.get(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox, '商品管理', '商品品牌',)
firefox.find_element_by_partial_link_text("添加品牌").click()
# 1.点击添加品牌按钮，品牌名称“苹果”。
firefox.find_element_by_xpath("//input[@id='brand_name']").send_keys(brandname)
firefox.find_element_by_xpath("//button").click()
# 2.点击“保存品牌”按钮。保存成功
try:
    firefox.find_element_by_xpath("//td[contains(text(),'%s')]"%brandname).is_displayed()
    writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)

